<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class CreateRechargeOrderTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('recharge_order', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('uid')              ->comment('充值人的uid')->default(0);
            $table->integer('order_sn')         ->comment('充值订单号') ->default(0);
            $table->decimal('total_amount')     ->comment('充值金额') ->default(0);
            $table->tinyInteger('pay_status')   ->comment('充值状态 0 待支付 1已支付 2充值成功') ->default(0);
            $table->timestamp('created_at')     ->comment('创建时间')->default(DB::raw('CURRENT_TIMESTAMP'));
            $table->timestamp('updated_at')     ->comment('修改时间')->default(DB::raw('CURRENT_TIMESTAMP'));
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('recharge_order');
    }
}
